package main

import (
	"fmt"
	"time"
)

func main() {
	a := 2
	go func() {
		a = 3
		fmt.Println("a，goroutine:", a) //a被赋值为3
	}()
	a = 4
	fmt.Println("a:", a) //本来a=4  再执行协程（goroutine）里面的程序
	time.Sleep(3 * time.Second)
	fmt.Println("a，main:", a) //这时a资源被协程抢夺  a为3
}
